'''
Created on 2012/02/15

@author: mercury
'''
from cocos.sprite import *
from cocos.actions import *
from cocos.euclid import Vector2
from cocos.collision_model import AARectShap
import cocos.euclid as eu
import cocos.collision_model as cm

class GameObject(object):
    """
    Game Object Base
    """
    def __init__(self, image, position=(0,0), rotation=0, scale=1, opacity = 255, color=(255,255,255), anchor = None ):
        """
        one sprite or three?
        """
        super(GameObject,self).__init__()
        self.sprite = Sprite(image, position, rotation, scale, opacity, color, anchor)
        self.rect=Sprite.get_rect()
        self.cshap=AARectShape(Vector2(self.rect.get_center()),self.rect.width/2,self.rect.height/2)
    
    def onStep(self):
        """
        update on step
        """
        pass
    
    def moveAction(self, *points):
        """
        repeat move in points 
        """
        for p in points:
            self.__moveActions += MoveBy(p,2)
        self.sprite.do(Reverse(self.__moveActions))
    
    
    def doInteract(self,target):
        """
        interact with target 
        for example : speak buy
        """
        pass
    
    def colliedAction(self,target):
        """
        aciton on collisioning
        """
        pass
    